load("sim_spatial.RData")
pdf("mise_vs_bw_spatial.pdf", width = 5, height = 4, pointsize = 12)
matplot(x = bwSeq, y = cbind(avg.mise.exact.offsets, avg.mise.mid, avg.mise.ems), type = "l", axes = FALSE, lty = c(1,3,2), col = 1, 
	xlim = c(0.05,0.8), ylim = c(0,0.015), 
	xlab = "Bandwidth", ylab = "MISE", 
	cex.lab = 0.8, lwd = 1)
box(lwd = 1)
axis(side = 1, at = seq(0.1, 0.8, by = 0.1), labels = TRUE, tick = TRUE, las = 1, cex.axis = 0.8)
axis(side = 2, at = seq(0, 0.015, by = 0.005), labels = TRUE, tick = TRUE, las = 2, cex.axis = 0.8)
dev.off()

opt.bw <- bwSeq[apply(cbind(avg.mise.exact.offsets,avg.mise.mid,avg.mise.ems), 2, which.min)]
min.mise <- apply(cbind(avg.mise.exact.offsets,avg.mise.mid,avg.mise.ems), 2, min)
opt.bw
min.mise
